int romanToInt(char* s) {
    int Symbolvalues[26];
    Symbolvalues['I' - 'A'] = 1;
    Symbolvalues['V' - 'A'] = 5;
    Symbolvalues['X' - 'A'] = 10;
    Symbolvalues['L' - 'A'] = 50;
    Symbolvalues['C' - 'A'] = 100;
    Symbolvalues['D' - 'A'] = 500;
    Symbolvalues['M' - 'A'] = 1000;
    int n = strlen(s);
    int ret = 0;
    for (int i = 0; i < n; i++) {
        int values = Symbolvalues[s[i] - 'A'];
        if (i < n - 1 && values < Symbolvalues[s[i + 1] - 'A']) {
            ret -= values;
        }
        else {
            ret += values;
        }
    }
    return ret;
}